/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.fiap.bean;

import javax.faces.bean.*;
import java.util.ArrayList;
/**
 *
 * @author rm62102
 */
//@ManagedBean(Name="listaalunos")
@ManagedBean(name = "notabean")
@SessionScoped
public class NotaBackBean {

    private ArrayList<Aluno> nota;
    private Aluno al = new Aluno();

    public Aluno getAl() {
        return al;
    }

    public void setAl(Aluno al) {
        this.al = al;
    }


    public ArrayList<Aluno> getNota() {
        return nota;
    }

    public void setNota(ArrayList<Aluno> nota) {
        this.nota = nota;
    }
    public NotaBackBean(){
        nota = new ArrayList<Aluno>();

        Aluno a1 = new Aluno();
        a1.setNome("Megan");
        a1.setSobrenome("Fox");
        a1.setNota(10);
        nota.add(a1);
    }

    public ArrayList<Aluno> getAlunos(){
        return nota;
    }

    public String editarNota(Aluno a){
        a.setNota(a.getNota()+1);
        return null;
    }

    public String addAluno(){
        nota.add(al);
        al = new Aluno();
        return null;
    }

    public String delAluno(Aluno a){
        nota.remove(a);
        return null;
    }
}
